package com.cykj.cotroller;

import com.cykj.pojo.AllMaxContext;
import com.cykj.pojo.Order1;
import com.cykj.pojo.Project;
import com.cykj.service.projectService;
import com.cykj.vo.pageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/project")
public class projectController {
    @Autowired
    private projectService projectService;
    @RequestMapping("/getProject")
    public List<Project> allproject(){
        List<Project> projects = projectService.projectAll();
        return projects;
    }

    @RequestMapping("/getPackage")
    public List<Package> allpackage(){
        List<Package> packages = projectService.packageAll();
        return packages;
    }

    @RequestMapping("/getById")
    public List<Project> getById(@RequestBody pageVo vo){
        List<Project> projects = projectService.selectByuserId(vo.getUserId(),vo.getNumber());
        return projects;
    }
    @RequestMapping("/allMax")
    public AllMaxContext allMax(@RequestBody pageVo vo) {
        AllMaxContext allMaxContext = projectService.allMax(vo.getOrderId());
        return allMaxContext;
    }
    @RequestMapping("/selectOrderId")
    public List<Order1> selectOrderId(@RequestBody pageVo vo) {
        List<Order1> order1 = projectService.selectOrderId(vo.getNumber());
        return order1;
    }
}
